using System;
using System.Collections.Generic;
using System.Text;

namespace NGinnBPM.Services
{
    /// <summary>
    /// Resource lock interface
    /// </summary>
    public interface IResourceLock : IDisposable
    {
        void Release();
    }


    /// <summary>
    /// Process instance locking interface
    /// </summary>
    public interface IResourceLockManager
    {
        IResourceLock AcquireWriteLock(string rcId);
        bool IsResourceLocked(string rcId);
        /// <summary>
        /// Acquire write lock only if the resource is unlocked now
        /// </summary>
        /// <param name="rcId"></param>
        /// <returns></returns>
        IResourceLock AcquireWriteLockIfUnlocked(string rcId);
    }


}
